<template>
  <div class="top-bar">
    {{ title }}
    <div class="top-bar-btns">
      <img @click="fanhui" src="@/assets/return.png" alt="" class="return" />
      <img
        @click="goHome"
        src="@/assets/tab-icon9.png"
        alt=""
        class="return-home"
      />
    </div>
  </div>
</template>

<script>
export default {
  name: "home",
  props: {
    title: {
      type: String,
      required: true,
    },
    isHome: {
      type: Boolean,
      default: () => true,
    },
  },
  methods: {
    fanhui() {
      this.$router.go(-1);
    },
    goHome() {
      if(this.isHome){
         this.$router.push("home");
      }else{
        this.$router.push("salesPerformance");
      }
     
    },
  },
};
</script>

<style lang="scss" scoped>
.top-bar {
  position: sticky;
  z-index: 99;
  top: 0;
  left: 0;
  width: 100%;
  height: 46px;
  text-align: center;
  line-height: 46px;
  font-size: 19px;
  color: #333;
  background: #fff;
  .top-bar-btns {
    position: absolute;
    left: 20px;
    top: 11px;
    display: flex;
    align-items: center;
    .return {
      width: 12px;
      height: 21px;
      object-fit: contain;
      margin-right: 7px;
    }
    .return-home {
      width: 22px;
      height: 22px;
      object-fit: contain;
    }
  }
}
</style>